@charset "utf-8";

@import '../../theme.scss';

.x-tabs {
  display: flex;
  height: px(100);
  position: relative;
  width: 100%;
  overflow: hidden;

  &--shrink {
    .x-tabs__scroller {
      overflow: auto;
      height: px(140);
      width: 100%;
      -webkit-overflow-scrolling: touch;
    }

    .x-tabs__inner {
      display: flex;
      height: px(100);
      position: relative;
      width: max-content;
      overflow: hidden;
    }

    .x-tabs__item {
      width: auto;
      padding: 0 px(50);
      flex: none;
    }
  }

  &__item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    flex: 1;
    margin: 0;
    position: relative;

    > span {
      color: var(--x-text-color);
      font-size: px(30);
    }

    &:active {
      color: inherit;
    }

    &::after {
      content: '';
      display: block;
      width: px(63);
      height: px(6);
      position: absolute;
      left: 50%;
      bottom: px(10);
      margin-left: px(-30);
      border-radius: px(3);
      opacity: 0;
      transform: scaleX(0);
      transition: all 0.2s ease-out;
      transform-origin: 0;
      background: linear-gradient(to left, #ffd100, rgba(#ffd100, 0));
    }
  }

  &--active {
    > span {
      color: var(--x-primary-color);
      font-weight: bold;
      animation: __x_tabs_active_scale 0.2s ease-out;

      &:active {
        color: var(--x-primary-color);
        opacity: 1;
      }
    }

    &::after {
      opacity: 1;
      transform: scaleX(1);
    }
  }
}

@keyframes __x_tabs_active_scale {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }

  100% {
    transform: scale(1);
  }
}
